<?php

namespace System;

use System\Model\CatalogTable;
use System\Model\VideosTable;
use System\Model\LinkTable;
use System\Model\NewsTable;
use System\Model\ImagesTable;
use System\Model\ProductsTable;

class Module {

    public function getAutoloaderConfig() {
        return array(
            'Zend\Loader\ClassMapAutoloader' => array(
                __DIR__ . '/autoload_classmap.php',
            ),
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function getConfig() {
        return include __DIR__ . '/config/module.config.php';
    }

    public function getServiceConfig() {
        return array(
            'factories' => array(
                'System\Model\CatalogTable' => function($sm) {
            $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
            $table = new CatalogTable($dbAdapter);
            return $table;
        },
                'System\Model\VideosTable' => function($sm) {
            $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
            $table = new VideosTable($dbAdapter);
            return $table;
        },
                'System\Model\NewsTable' => function($sm) {
            $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
            $table = new NewsTable($dbAdapter);
            return $table;
        },
                'System\Model\LinkTable' => function($sm) {
            $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
            $table = new LinkTable($dbAdapter);
            return $table;
        },
                'System\Model\ImagesTable' => function($sm) {
            $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
            $table = new ImagesTable($dbAdapter);
            return $table;
        },
                'System\Model\ProductsTable' => function($sm) {
            $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
            $table = new ProductsTable($dbAdapter);
            return $table;
        },
            ),
        );
    }

}
